# Maintainer: Maxim Baz <$pkgname at maximbaz dot com>
# Contributor: Maxime de Roucy <maxime.deroucy@gmail.com>

pkgname=libu2f-server
pkgver=1.1.0
pkgrel=5
pkgdesc='Yubico Universal 2nd Factor (U2F) Server C Library'
arch=('loong64' 'x86_64')
url='https://developers.yubico.com/libu2f-server'
license=('BSD')
depends=('openssl' 'json-c')
makedepends=('check' 'gengetopt' 'help2man')
source=("${url}/Releases/${pkgname}-${pkgver}.tar.xz"{,.sig}
        json-c-0.14.patch)
sha256sums=('8dcd3caeacebef6e36a42462039fd035e45fa85653dcb2013f45e15aad49a277'
            'SKIP'
            'cdeaf6387e8f4b49a32e272e9aa8c7f86305b6911e8d09084125f608af72492b')
validpgpkeys=('B70D62AA6A31AD6B9E4F9F4BDC8888925D25CA7A') # Alessio Di Mauro <alessio@yubico.com>

prepare() {
    cd "${pkgname}-${pkgver}"
    patch -Np1 -i ../json-c-0.14.patch
}

build() {
    cd "${pkgname}-${pkgver}"

    ./configure --prefix=/usr
    make
}

check() {
    cd "${pkgname}-${pkgver}"

    make check
}

package() {
    cd "${pkgname}-${pkgver}"

    make DESTDIR="${pkgdir}" install

    install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" COPYING
}

# vim:set ts=4 sw=4 et:
